<template>
  <div class="Pageheader">
    <div class="setting">
      <span class="placeholder"></span>
      <h1>我的</h1>
      <span class="iconfont icon-shezhi"></span>
    </div>
    <!-- 个人信息 -->
    <div class="author">
      <div class="avatar">
        <img :src="avatar" alt="" />
      </div>
      <!-- 登陆的用户信息 -->
      <div class="author-info" v-if="user.name != 'default'">
        <p>
          <span>{{ user.name }}</span>
          <span class="iconfont icon-yiji"></span>
        </p>
        <p>
          <span class="id">ID:{{ user.id }}</span>
          <span class="copy">复制</span>
        </p>
      </div>
      <!-- 默认的 -->
      <div class="default-info" v-else @click="$router.push({ name: 'login' })">
        点击登录
      </div>
      <div class="access">
        <van-icon name="arrow" />
      </div>
    </div>

    <!-- 登陆后的开通会员 -->
    <div class="openvip" v-if="user.name != 'default'">
      <div class="left">
        <p>开通追书尊享会员</p>
        <p>十万书库免费看，8大权益开通即可享受</p>
      </div>
      <div class="right">
        <button>立即开通</button>
      </div>
    </div>
    <!-- 默认是点击登录 -->
    <div class="openvip" @click="$router.push({ name: 'login' })" v-else>
      <div class="left">
        <p>点击登录</p>
        <p>更多权益、福利 登录即可体验</p>
      </div>
      <div class="right">
        <button>立即登录</button>
      </div>
    </div>
    <!-- 无广告 -->
    <div class="advantage">
      <ul>
        <li>
          <img src="../../assets/images/mine_vip_power_0.png" alt="" />
        </li>
        <li>
          <img src="../../assets/images/mine_vip_power_1.png" alt="" />
        </li>
        <li>
          <img src="../../assets/images/mine_vip_power_2.png" alt="" />
        </li>
        <li>
          <img src="../../assets/images/mine_vip_power_3.png" alt="" />
        </li>
        <li>
          <img src="../../assets/images/mine_vip_power_4.png" alt="" />
        </li>
        <li>
          <img src="../../assets/images/mine_vip_power_5.png" alt="" />
        </li>
        <li>
          <img src="../../assets/images/mine_vip_power_6.png" alt="" />
        </li>
        <li>
          <img src="../../assets/images/mine_vip_power_8.png" alt="" />
        </li>
      </ul>
    </div>

    <div style="height: 11px; background: #f3f3f3"></div>
  </div>
</template>

<script>
import { mapState } from "vuex";
export default {
  computed: {
    ...mapState(["user"]),
    avatar() {
      return this.login
        ? require("../../assets/images/avatar.jpg")
        : "https://h5.zhuishushenqi.com/v2/dist/image/5a74e196801d.default-avatar.png";
    },
  },
};
</script>

<style lang="less">
.Pageheader {
  background: url("../../assets/images/mine_red_normal_icon.png") no-repeat
    center center;
  background-size: cover;
  padding: 16px 0px 0;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  z-index: -1;
  height: 257px;
  &:after {
    content: "";
    display: block;
    clear: both;
  }
  .setting {
    padding: 16px 16px;
    text-align: center;
    display: flex;
    align-items: center;
    .avatar {
      flex-basis: 30px;
    }
    h1 {
      font-size: 16px;
      font-weight: bolder;
      flex: 1;
      color: white;
      padding-left: 30px;
    }
    .icon-shezhi {
      flex-basis: 30px;
      color: white;
    }
  }

  //账户信息
  .author {
    display: flex;
    padding: 10px 16px 15px;
    .avatar {
      flex-basis: 50px;
      img {
        width: 50px;
        border-radius: 50%;
      }
    }
    .author-info {
      margin-left: 20px;
      flex: 1;
      display: grid;
      align-content: space-around;
      color: white;
      padding: 0 16px;
      p:first-child {
        font-size: 20px;
        font-weight: bold;
        span:first-child {
          margin-right: 10px;
        }
      }
      p:last-child {
        font-size: 13px;
        .id {
          display: inline-block;
          width: 130px;
          overflow: hidden;
          text-overflow: ellipsis;
          zoom: 0.9;
          vertical-align: middle;
        }
        .copy {
          display: inline-block;
          font-size: 12px;
          padding: 2px 8px;
          border-radius: 20px;
          border: 0.5px solid white;
        }
      }
    }
    .default-info {
      margin-left: 20px;
      display: grid;
      align-content: space-around;
      letter-spacing: 2px;
      flex: 1;
      font-size: 20px;
      font-weight: 600;
      color: white;
      padding: 0 16px;
    }
    .access {
      .van-icon-arrow {
        font-size: 25px;
        color: white;
        line-height: 50px;
      }
    }
  }
  //开通vip
  .openvip {
    border: 2px rgb(209, 207, 207) solid;
    border-bottom: 0px;
    display: flex;
    justify-content: space-between;
    border-radius: 10px 10px 0 0;
    padding: 15px;
    width: 90%;
    margin: auto;
    box-sizing: border-box;
    margin-top: -1px;
    background: linear-gradient(to right, #dcdfeb, #b1b7c7);
    .left {
      p:first-child {
        margin-bottom: 10px;
        font-size: 14px;
      }
      p:last-child {
        color: rgb(144, 144, 145);
        zoom: 0.8;
      }
    }
    .right {
      display: grid;
      place-content: center;
      flex-basis: 30%;
      button {
        color: white;
        font-weight: bold;
        background: linear-gradient(to bottom, #9593a8, #5b6075);
        border-radius: 20px;
        padding: 8px 13px;
      }
    }
  }
  //特权
  .advantage {
    overflow: hidden;
    width: 100%;
    background: white;
    margin-top: -1px;
    ul {
      overflow-x: auto;
      white-space: nowrap;
      padding: 10px 16px;
      li {
        display: inline-block;
        margin-right: 4px;
        img{
          height: 60px;
          // width: 70px;
        }
      }
    }
  }
}
</style>